---
sidebar_position: 3
---

<div class="api-link">
  <div class="api-link-title">Client</div>
  <div class="api-link-sub-title">

[Read the API Reference »](/api/Hyper-Fetch/Function/fetchClient.md)

  </div>
</div>

---

## Introduction

**`Client`** is a function that is responsible for communication with the server. The default client is used to
communicate with the REST server. However, there is nothing to prevent you from changing this and creating the client
you need. Thanks to event communication, you can set your own client as you wish.

By default, the client is responsible for requests, but its role is very significant for many other elements – such as
tracking the progress of requests, listening for cancellation, and mapping payloads and headers. It also applies to all
the interceptors in the requesting lifecycle.

:::caution

If there is no XHR in the window object or the XHR object is a polyfill in your environment, you’ll have to install the
npm package [xmlhttprequest](https://www.npmjs.com/package/xmlhttprequest) and set it on the window object.

:::

---

## Preview

(@import HyperFetch fetchClient type=type=preview)

---

## Purpose

- Requests handler for builder dispatchers
- Provides flexibility via handler changeability

---
